package com.fafu;

import com.fafu.service.StudentService;
import com.fafu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyInterceptorConfig extends WebMvcConfigurerAdapter  {
    @Bean
    public MyInterceptor myInterceptor(){
        return new MyInterceptor();
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor()).addPathPatterns("/**")
                .excludePathPatterns("/verify/*")
                .excludePathPatterns("/user/getid")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/swagger-resources/**")
                .excludePathPatterns("/webjars/**")
                .excludePathPatterns("/swagger-ui.html")
                .excludePathPatterns("/v2/**")
                .excludePathPatterns("/error")
                .excludePathPatterns("/app/**")
                .excludePathPatterns("/appwork/**")
                .excludePathPatterns("/tool/picUpload");
        super.addInterceptors(registry);
    }
}
